package ua.org.nuos.sdms.clientgui.client.components.window;

import com.vaadin.ui.Window;
import ua.org.nuos.sdms.clientgui.server.AppProxy;

/**
 * Created by IntelliJ IDEA.
 * User: dio
 * Date: 19.02.12
 * Time: 20:07
 * To change this template use File | Settings | File Templates.
 */
public class AbstractWindow {

    protected Window window;
    protected Window parentWindow;

    public void addWindowCloseListener(Window.CloseListener listener) {
        window.addListener(listener);
    }

    public void show() {
        this.parentWindow = AppProxy.getInstance().getAppTools().getMainWindow();
        this.parentWindow.addWindow(window);
        window.setParent(parentWindow);
    }

    public void close() {
        parentWindow.removeWindow(window);
    }

    public Window getWindow() {
        return window;
    }
}

